<template>
  <div style="display: inline-block;width: 110px;overflow: hidden;">
    <v-select
      v-bind="$attrs"
      v-model="selection"
      :items="items"
      hide-details
      dense
      v-on="$listeners"
    ></v-select>
  </div>
</template>

<script>
import { getPlanCodeDetail } from '@/api/plan'
export default {
  props: {
    main: {
      type: Boolean,
      default: true
    },
    value: String
  },
  data() {
    return {
      data: []
    }
  },
  computed: {
    items() {
      return this.main ? this.data.code_sign1Arr : this.data.code_sign2Arr
    },
    selection: {
      get() {
        return this.value || (this.items && this.items[0])
      },
      set(val) {
        this.$emit('input', val)
      }
    }
  },
  created() {
    getPlanCodeDetail().then(res => {
      this.data = res.data
      this.$emit('input', this.items && this.items[0])
    })
  }
}
</script>

<style>

</style>